#!/usr/bin/env python
from utils.singleton import singleton
import wx

FOLDER_NETWORK=0
SERVER=1
SERVER_NETWORK=2
SERVER_PROPERTY=3
DATABASE_NETWORK=4
DATABASE=5
STATUS_ON=6
STATUS_AWAY=7
STATUS_BUSY=8
STATUS_OFF=9
HAMMER=10
GEAR=11

@singleton
class MediaLib(wx.ImageList):
    def __init__(self):
        self._img={}
        wx.ImageList.__init__(self,16,16)
        
    #*Test
    #@param {str} name
    def addImage(self,name,path):
        bmp = wx.Image(path).ConvertToBitmap()
        id=self.Add(bmp)
        self._img[name]=id
        return id
    
    def addQuickImage(self,path):
        bmp = wx.Image(path).ConvertToBitmap()
        id=self.Add(bmp)
        return id
    
    def addBitmap(self,name,bitmap):
        id=self.Add(bitmap)
        self._img[name]=id
        return id
        
        
    def getId(self,name):
        return self._img[name];
        
        
def init():
    MediaLib().addQuickImage("media/folder-network.png")
    MediaLib().addQuickImage("media/server.png")
    MediaLib().addQuickImage("media/server-network.png")
    MediaLib().addQuickImage("media/server-property.png")
    MediaLib().addQuickImage("media/database-network.png")
    MediaLib().addQuickImage("media/database.png")
    MediaLib().addQuickImage("media/status.png")
    MediaLib().addQuickImage("media/status-away.png")
    MediaLib().addQuickImage("media/status-busy.png")
    MediaLib().addQuickImage("media/status-offline.png")
    MediaLib().addQuickImage("media/hammer-screwdriver.png")
    MediaLib().addQuickImage("media/gear.png")
    
    
